package com.shaoshaohuo.app.utils;

public class CollectionUtil {
	//搜索方法，未找到时，返回该参数
	public static final int NOT_EXIST = -1;
	
	public static int search(String[] array, String target) {
		if (array == null || StringUtil.isEmpty(target)) {
			throw new NullPointerException();
		}
		for (int i = 0; i < array.length; i++) {
			if (StringUtil.isEmpty(array[i])) {
				throw new NullPointerException();
			}
			if (target.equals(array[i])) {
				return i;
			}
		}
		return NOT_EXIST;
	}
}
